//
//  TDOrderDetailScrollCell.m
//  TBRentClient
//
//  Created by tonbright on 2018/6/18.
//  Copyright © 2018年 tonbright. All rights reserved.
//

#import "TDOrderDetailScrollCell.h"
#import "SDCycleScrollView.h"
#import <UIImageView+WebCache.h>
#import "NSString+Rect.h"
#import "UIView+ZLExtension.h"
@interface TDOrderDetailScrollCell()<SDCycleScrollViewDelegate>
@property (nonatomic, strong) SDCycleScrollView *cycleScrollView;
@end
@implementation TDOrderDetailScrollCell

- (void)awakeFromNib {
    [super awakeFromNib];
    SDCycleScrollView *cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, 0, Width, 220) delegate:self placeholderImage:[UIImage imageNamed:@"home_banner_default"]];
    cycleScrollView.autoScrollTimeInterval = 5;
    cycleScrollView.pageDotImage = [[UIImage imageNamed:@"矩形白色"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    cycleScrollView.currentPageDotImage = [UIImage imageNamed:@"矩形黑色"];
    cycleScrollView.pageControlDotSize = CGSizeMake(20, 5);
    self.cycleScrollView = cycleScrollView;
    [self.view_content addSubview:cycleScrollView];
    [self.view_content bringSubviewToFront:_lbe_showStatus];
    _lbe_showStatus.layer.borderColor = [UIColor lightGrayColor].CGColor;
    _lbe_showStatus.layer.borderWidth = 1;
    _lbe_showStatus.layer.cornerRadius = 4;
    _lbe_showStatus.layer.masksToBounds = YES;
    [_lbe_showStatus sizeToFit];
}


- (void)setOrderDetailModel:(TDOrderDetailModel *)orderDetailModel {
    _orderDetailModel = orderDetailModel;
    NSMutableArray *tmpImageArray = [NSMutableArray array];
    NSArray *tmpArray = orderDetailModel.materiallist;
    for (TDOrderdetaillistEnumModel *enumModel in tmpArray) {
        NSString *tmpImageUrl = [NSString stringWithFormat:@"http://121.40.92.131/deepdriving/%@",enumModel.linkurl];
        [tmpImageArray addObject: tmpImageUrl];
    }
    self.cycleScrollView.imageURLStringsGroup = tmpImageArray;
    _lbe_brandnm.text = [NSString stringWithFormat:@"%@ %@",orderDetailModel.brandnm,orderDetailModel.seriesnm];
    _lbe_typenm.text = orderDetailModel.typenm;
    _lbe_storenm.text = [NSString stringWithFormat:@"试驾门店 : %@",orderDetailModel.storename];
    NSString *logoUrlStr = [NSString stringWithFormat:@"http://121.40.92.131/deepdriving/%@",_orderDetailModel.rstorelogo];
    [_lbe_photo sd_setImageWithURL:[NSURL URLWithString:logoUrlStr] placeholderImage:[UIImage imageNamed:@"car"]];
    _lbe_startOffTime.text = [NSString stringWithFormat:@"营业时间 : %@-%@",_orderDetailModel.rservicetimefrom,_orderDetailModel.rservicetimeto];
    _lbe_showStatus.text =  [NSString stringWithFormat:@" %@ ",_orderDetailModel.statusnm];
}


@end
